#!python
# coding=utf-8
'''
FilePath     : /code/utils/glob_utils.py
Description  :  
Author       : desyang
Date         : 2025-09-25 14:57:04
LastEditors  : desyang
LastEditTime : 2025-09-25 15:00:08
'''
import os
import glob

IMG_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.bmp', '.tif', '.tiff', '.gif']

def glob_file(img_dir, patterns: list = IMG_EXTENSIONS) -> list:
    """ 获取指定目录下的文件，并将路径转换为绝对路径 """
    files = []
    for pattern in patterns:
        matched_files = glob.glob(os.path.join(img_dir, '*' + pattern))
        files.extend(matched_files)
    
    # 转换为绝对路径并返回
    return [os.path.abspath(file) for file in files]